package com.fire.control.system.module.warning.controller.app;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.fire.control.system.module.common.controller.BaseController;
import com.fire.control.system.module.warning.service.AppWarningService;
import com.fire.control.system.standard.BusinessInterfaceStandard;
import com.fire.control.system.support.protocol.app.AppRequestProtocol;
import com.fire.control.system.support.protocol.comman.ResponseProtocol;
/**
 * 
 * @ClassName:  AppWarningController
 * @Description:  报警管理控制器
 * @author:  xiechengguang
 * @date:  2017年5月12日 下午5:59:58
 *
 */
@RestController
@RequestMapping(value = "/app/warning")
public class AppWarningController extends BaseController implements BusinessInterfaceStandard<AppRequestProtocol, ResponseProtocol> {
	@Autowired
	private AppWarningService appWarningService;
	
	/**
	 * @Title: getWarningInfo   
	 * @Description: 根据id获取报警详细信息  
	 * @param:        
	 * @return: ResponseProtocol      
	 * @throws
	 */
	@RequestMapping(value="/getWarningInfo", method=RequestMethod.POST)
	public ResponseProtocol getWarningInfo(@RequestBody AppRequestProtocol requestProtocol) {
		
		return appWarningService.getWarningInfo(requestProtocol);
	}
	
	/**
	 * 
	 * @Title: getLinkman   
	 * @Description: 根据报警id获取火灾报警联系人  
	 * @param:        
	 * @return: ResponseProtocol      
	 * @throws
	 */
	@RequestMapping(value="/getLinkman", method=RequestMethod.POST)
	public ResponseProtocol getLinkman(@RequestBody AppRequestProtocol requestProtocol) {
		
		return appWarningService.getLinkman(requestProtocol);
	}
	
	/**
	 * 火灾现场报告、故障处理说明公共方法
	 * @Title: report   
	 * @Description: TODO  
	 * @param:        
	 * @return: ResponseProtocol      
	 * @throws
	 */
	@RequestMapping(value="/report", method=RequestMethod.POST)
	public ResponseProtocol report(@RequestBody AppRequestProtocol requestProtocol) {
		
		return appWarningService.report(requestProtocol, getUser());
	}
	
	/**
	 * 
	 * @author: xiechengguang 
	 * @Title: sureWarning   
	 * @Description: 确认报警，前端根据返回成功状态，
	 * 若是火灾报警则跳转到电话报警，若是故障报警则跳转到处理报警页面
	 * @param:        
	 * @return: ResponseProtocol      
	 * @throws
	 */
	@RequestMapping(value="/sureWarning", method=RequestMethod.POST)
	public ResponseProtocol sureWarning(@RequestBody AppRequestProtocol requestProtocol) {
		
		return appWarningService.sureWarning(requestProtocol);
	}
	
	/**
	 * 
	 * @author: xiechengguang 
	 * @Title: handles   
	 * @Description: 报警处理情况
	 * @param:        
	 * @return: ResponseProtocol      
	 * @throws
	 */
	@RequestMapping(value="/handles", method=RequestMethod.POST)
	public ResponseProtocol handles(@RequestBody AppRequestProtocol requestProtocol) {
		
		return appWarningService.handles(requestProtocol);
	}
	
	/**
	 * @author: xiechengguang 
	 * @Title: finishWarning   
	 * @Description: 火灾报警---完成报警流程  
	 * @param:        
	 * @return: ResponseProtocol      
	 * @throws
	 */
	@RequestMapping(value="/finishWarning", method=RequestMethod.POST)
	public ResponseProtocol finishWarning(@RequestBody AppRequestProtocol requestProtocol) {
		
		return appWarningService.finishWarning(requestProtocol);
	}
	
	/**
	 * @author: xiechengguang 
	 * @Title: handleLog   
	 * @Description: 我的工作记录---故障/ 误报/ 火警  
	 * @param:        
	 * @return: ResponseProtocol      
	 * @throws
	 */
	@RequestMapping(value="/handleLog", method=RequestMethod.POST)
	public ResponseProtocol handleLog(@RequestBody AppRequestProtocol requestProtocol) {
		
		return appWarningService.handleLog(requestProtocol, getUser());
	}
	
	/**
	 * 
	 * @author: xiechengguang 
	 * @Title: receive   
	 * @Description: 接警
	 * @param:        
	 * @return: ResponseProtocol      
	 * @throws
	 */
	@RequestMapping(value="/receive", method=RequestMethod.POST)
	public ResponseProtocol receive(@RequestBody AppRequestProtocol requestProtocol) {
		
		return appWarningService.receive(requestProtocol);
	}
	
}
